//
// Created by liushuai on 2020/3/19.
//
#include "hasCycle.h"
bool hasCycle(ListNode *head){
    ListNode* fast=head;
    ListNode* slow=head;
    while (slow&&fast){
        slow=slow->next;
        if(fast->next)
            fast=fast->next->next;
        else
            return false;
        if(fast==slow)
            return true;
    }
    return false;

}
